<?php
/* * 注意此文档为UTF-8的编码.
 * Created on 2010-9-18
 *
 * @author EXT <isrn@qq.com>
 *
 */
include ('../../includes/global.php');
include ('../global.php');
include ("../power.php");
$dbcfg = Sys::Gp(array('dbcfg', 'sevenel'));
$id = $_POST['id'];
$tree_id = $_POST['tid'];
$wyyz = array('xr', 'r', 'c', 'd', 'u', 'b', 'q', 'xt', 'pz');
foreach ($wyyz as $value) {
    $temp[$value] = $_POST[$value];
}
$_POST['cfg'] = json_encode($temp);
$_POST['at'] = time();
if ($id != 0) {
    if (Du('sevenel', 'rtp', $_POST, 'id', $id, 1)) ja('更新成功');
    //重置当前登录用户权限
    if ($_SESSION['userinfo']['user'] != '') {
        $tmp = Dgd(array(
            'db' => 'd_sevenel',
            'tn' => 'rtp',
            'cd' => " id = '" . $_SESSION['userinfo']['rcfg'] . "' ",
            'limit' => 1
                ));
        if ($_SESSION['userinfo']['user'] == 'admin') {
            $_SESSION['rcg'] = 'A';
        } else {
            $_SESSION['rcg'] = json_decode($tmp['cfg'],true);
        }
    }
} else {
    if (Di('sevenel', 'rtp', $_POST)) ja('添加成功');
}
?>
<script>
    n=parent.tabs.getActiveTab();
    parent.tabs.remove(n);
</script>